package study.datastructure.search.avl;/**
 * @program: datastructure
 * @author: lcy
 * @create: 2024-06-25 22:43
 */

/**
 2024/6/25,
 */

//平衡二叉树
public class AVLTree {
Node root;

public Node insert(Node key,int value){


    return null;
}


//获取节点的高度
    int height(Node node){
    if(node==null){
        return 0;
    }
    return node.height;
    }

//获取平衡因子
    int getBalance(Node node){
    if (node==null){
        return 0;
    }
    return height(node.left)-height(node.right);
    }



    // 测试代码
    public static void main(String[] args) {
        AVLTree tree = new AVLTree();
         //tree.root= Node.insert(tree.root, 10);


        tree.root = Node.insert(tree.root, 10);
        tree.root = Node.insert(tree.root, 20);
        tree.root = Node.insert(tree.root, 30);
        tree.root = Node.insert(tree.root, 40);
        tree.root = Node.insert(tree.root, 50);
        tree.root = Node.insert(tree.root, 25);

        System.out.println("Inorder traversal of constructed tree is : ");
        Node.inOrder(tree.root);
    }
}
